package action.chap5;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * @author 孙峰
 * @Description: TODO
 * @date 2020/12/9 20:57
 */
public class Demo541 {
    public static void main(String[] args) {
        List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);
        Optional<Integer> reduce = numbers.stream().reduce(Integer::sum);
        reduce.ifPresent(System.out::println);

        Optional<Integer> reduce1 = numbers.stream().reduce(Integer::max);

    }
}
